//
//  LeftViewController.m
//  谈诗说词
//
//  Created by dllo on 15/6/16.
//  Copyright (c) 2015年 lanou3g.com蓝鸥科技. All rights reserved.
//

#import "LeftViewController.h"
#import "CollectViewController.h"
#import "HotViewController.h"
#import "AboutViewController.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
@interface LeftViewController ()

@end

@implementation LeftViewController
- (void)dealloc
{
    
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = NO;
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.view.alpha = 0.9;
    UIImageView *back = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT )];
    [back setImage:[UIImage imageNamed:@"left.png"]];
    [self.view addSubview:back];
    
    
    [self createButton];
}

- (void)createButton
{
    UIButton *collect = [[UIButton alloc]initWithFrame:CGRectMake(0.5 * WIDTH, 0.285 * WIDTH, 0.45 * WIDTH, 0.12 * WIDTH)];
//    [collect setBackgroundColor:[UIColor blackColor]];
//    [collect setTitle:@"我的收藏" forState:UIControlStateNormal];
//    [collect setTitleColor:[UIColor colorWithRed:223/255.0 green:223/255.0 blue:223/255.0 alpha:1.0] forState:UIControlStateNormal];
//    collect.titleLabel.font = [UIFont fontWithName:@"yuweij" size:27];
    [collect addTarget:self action:@selector(collectAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:collect];
    
    
    
    UIButton *hot = [[UIButton alloc]initWithFrame:CGRectMake(0.5 * WIDTH, 0.63 * WIDTH, 0.45 * WIDTH, 0.12 * WIDTH)];
//    [hot setBackgroundColor:[UIColor blackColor]];
    //[hot setTitle:@"随机推荐" forState:UIControlStateNormal];
    //[hot setTitleColor:[UIColor colorWithRed:223/255.0 green:223/255.0 blue:223/255.0 alpha:1.0] forState:UIControlStateNormal];
    //hot.titleLabel.font = [UIFont fontWithName:@"yuweij" size:27];
    [hot addTarget:self action:@selector(hotAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:hot];
    
    UIButton *about = [[UIButton alloc]initWithFrame:CGRectMake(0.5 * WIDTH, 0.99 * WIDTH, 0.45 * WIDTH, 0.1 * WIDTH)];
//    [about setBackgroundColor:[UIColor blackColor]];
    //[about setTitle:@"关于我们" forState:UIControlStateNormal];
    //[about setTitleColor:[UIColor colorWithRed:223/255.0 green:223/255.0 blue:223/255.0 alpha:1.0] forState:UIControlStateNormal];
    //[about setBackgroundColor:[UIColor blackColor]];
    //about.titleLabel.font = [UIFont fontWithName:@"yuweij" size:27];
    [about addTarget:self action:@selector(aboutAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:about];
    
    UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(WIDTH - 0.133*0.6 *WIDTH , 20, 0.133*0.6*WIDTH, 0.1093 * WIDTH*0.6)];
    [backButton setImage:[UIImage imageNamed:@"x3.png"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
}

// 返回按钮点击事件
- (void)backButtonClick:(UIButton *)button
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showLeft" object:@(NO)];
}

- (void)collectAction
{
    CollectViewController *collect = [[CollectViewController alloc]init];
    UINavigationController *nav = (UINavigationController *)self.view.window.rootViewController;
    [nav pushViewController:collect animated:YES];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showLeft" object:@(NO)];
}
- (void)hotAction
{
    HotViewController *hot = [[HotViewController alloc]init];
    UINavigationController *nav = (UINavigationController *)self.view.window.rootViewController;
    [nav pushViewController:hot animated:YES];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showLeft" object:@(NO)];
}

- (void)aboutAction
{
    AboutViewController *about = [[AboutViewController alloc]init];
    UINavigationController *nav = (UINavigationController *)self.view.window.rootViewController;
    [nav presentViewController:about animated:YES completion:nil];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showLeft" object:@(NO)];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
